const http = require('http'),
url = require('url'),
log = require('../util/log');

const parsedUrl = url.parse('http://www.tuling123.com/openapi/api', true),
options = {
	host: parsedUrl.hostname,
	port: parsedUrl.port,
	path: parsedUrl.pathname,
	method: 'POST'
}
if (parsedUrl.search)
	options.path += '?' + parsedUrl.search;
const req = http.request(options, (res) => {
		var body = []
		res.on('data', (chunk) => {
			body.push(chunk)
		}).on('end', () => {
			var result = Buffer.concat(body).toString();
			log(result)
		}).on('error', (err) => {
			log(err)
		})
	});
req.on('error', (err) => {
	log(err)
	resolve('获取title失败')
})
req.end(JSON.stringify({
		key: 'c5a4aaeb508648878d52282b97f3a4fa',
		info: '你好'
	}))
